package com.example.service;

import com.example.dao.IcommentDao;
import com.example.model.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description TODO
 * @Date 2022/9/20 19:52
 * @author 27954
 */
@Transactional
@Service
public class CommentService implements ICommentService{
    @Autowired
    IcommentDao icommentDao;

    @Override
    public List<Comment> loadAllByComment(Integer discussId) {
        List<Comment> list=icommentDao.findAllByDiscussIdAndRIdIsNull(discussId);
        return list;
    }

    @Override
    public List<Comment> loadAllChildComment(Integer rid) {
        return icommentDao.findAllByRId(rid);
    }

    @Override
    public void delComment(Integer cid,Integer uid) {
        icommentDao.deleteComment(uid,cid);
    }
}
